<!--权限控制-->
<template>
  <div>
    <el-card class="box-card m-b-10">
      <div slot="header" class="clearfix">
        <span>按钮权限</span>
      </div>
      <el-alert
        title="参考文件‘@/utils/allPermission.js’"
        type="success" />
      <div style="margin-top:10px">
        <el-button :disabled="!$P.hasPermission($P.DATADICT_SAVE)">新增字典组</el-button>
        <el-button :has-permission="$P.DATADICTITEM_UPDATE">编辑字典组</el-button>
        <el-button :disabled="!$P.hasPermission($P.USER_UNIT_SAVE)">新增组织机构</el-button>
      </div>

    </el-card>
    <el-card class="box-card m-b-10">
      <div slot="header" class="clearfix">
        <span>页面权限</span>
      </div>
      <el-alert
        title="参考文件路由安全守卫‘@/router/router.security.js’"
        type="success" />
      <div style="margin-top:10px">
        <pre v-highlight>
          <code>
  if (defaultSettings.openPagePer) {
    if (to.name !== 'noPermission' && !allPermission.hasMenu(to.name)) {
      next(`/noPermission?permission=${to.name}&menuName=${to.meta.title}`)
      return
    }
  }
          </code>
        </pre>
      </div>
    </el-card>

  </div>
</template>
<script>
export default {
  data() {
    return {
      code: `if (defaultSettings.openPagePer) {
          if (to.name !== 'noPermission' && !allPermission.hasMenu(to.name)) {
            next(/noPermission?permission=&menuName=)
            return
          }
        }`
    }
  },
  created() {
  },
  methods: {
  }

}
</script>
